<template>
	<!--pages/AwardDetail/AwardDetail.wxml-->
	<view>
		<view class="award-box">
			<image :src="AwardDetail.prize_img" class="award-img"></image>
			<view class="award-name">{{AwardDetail.prize_name}}</view>
		</view>
		<view class="notice">注：该商品由{{ AwardDetail.grant_type==0||1?'商户':'门店'}}发放</view>
		<view class="btn" @tap="awarddetail_btn" :data-name="AwardDetail.status">{{AwardDetail.status==1?'立即领取':'查看详情'}}
		</view>
	</view>
</template>

<script>
	// pages/AwardDetail/AwardDetail.js
	var app = getApp().globalData;

	export default {
		data() {
			return {
				AwardDetail: {}
			};
		},

		components: {},
		props: {},

		onLoad(options) {
			// #ifdef MP-ALIPAY
			if (JSON.stringify(options) == '{}') {
				options = my.getLaunchOptionsSync().query;
			}
			// #endif
			getApp().globalData.sendRequest({
				url: '/Turntable/winTurntablePrizeDetail',
				type: "post",
				data: {
					win_id: options.id
				},
				success: res => {
					if (res.code == 0) {
						this.setData({
							AwardDetail: res.data
						});
					}
				}
			});
		},

		/**
		 * 生命周期函数--监听页面初次渲染完成
		 */
		onReady: function() {},

		/**
		 * 生命周期函数--监听页面显示
		 */
		onShow: function() {},

		/**
		 * 生命周期函数--监听页面隐藏
		 */
		onHide: function() {},

		/**
		 * 生命周期函数--监听页面卸载
		 */
		onUnload: function() {},

		/**
		 * 页面相关事件处理函数--监听用户下拉动作
		 */
		onPullDownRefresh: function() {},

		/**
		 * 页面上拉触底事件的处理函数
		 */
		onReachBottom: function() {},

		/**
		 * 用户点击右上角分享
		 */
		onShareAppMessage: function() {},
		methods: {
			/**
			 * 生命周期函数--监听页面加载  
			 */
			awarddetail_btn(e) {
				var name = e.currentTarget.dataset.name;

				if (name == 1) {
					uni.navigateTo({
						url: '../order/Information/Information?id=' + this.AwardDetail.id + '&prize_id=' + this
							.AwardDetail.prize_id
					});
				} else if (name == 2) {
					uni.navigateTo({
						url: '../order/OrderDetail/OrderDetail?id=' + this.AwardDetail.id + '&delivery_type=' +
							this.AwardDetail.delivery_type
					});
				}

				console.log(name);
			}

		}
	};
</script>
<style>
	@import "./AwardDetail.css";
</style>
